<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			.moveDiv{
				font-size: 36px;
				color: #00f;
				position: relative;
				left: 200px;
				top: 200px;
			}
		</style>
		<script type="text/javascript">
			var t
			var curLeft
			var curTop
			var x
			var y
			
			function down(e)
			{
				console.log(e)
				console.log(e.clientX+"+"+e.clientY)
				
				if(e.target.className=="moveDiv")
				{
					t=e.target
					curLeft=t.offsetLeft
					curTop=t.offsetTop
					x=e.clientX
					y=e.clientY
					
					document.onmousemove=move
					document.onmouseup=function(){
						document.onmousemove=null
					}
					
				}
			}
			function move(e)
			{
				t.style.left=curLeft+(e.clientX-x)+"px"
				t.style.top=curLeft+(e.clientY-y)+"px"
				return false
			}
			document.onmousedown=down
		</script>
	</head>
	<body>
		<div class="moveDiv">
			Hello world
		</div>
	</body>
</html>
